﻿
using AutoMapper;
using Microsoft.AspNetCore.Identity;
using Model;

namespace WebApplication1.Extensions
{

    public class CustomProfile : Profile
    {
        /// <summary>
        /// 配置构造函数，创建对应映射关系
        /// </summary>
        public CustomProfile() {
            CreateMap<User, UserVo>()
                .ForMember(a => a.UserName, o => o.MapFrom(d => d.userName));
            CreateMap<User, UserVo>()
                .ForMember(a => a.Id, o => o.MapFrom(d => d.id));
            CreateMap<UserVo, User>()
                .ForMember(a =>a.userName,o => o.MapFrom(d =>d.UserName));
            CreateMap<UserVo, User>()
                .ForMember(a => a.id, o => o.MapFrom(d => d.Id));
        }
    }
}
